package com.github.zdongcoding.recyclerviewlib;

import android.support.v4.content.ContextCompat;

import com.github.zdg.recyclerview.RecyclerListAdapter;
import com.github.zdg.recyclerview.itemdecoration.GridEdgeDividerDecoration;
import com.github.zdongcoding.recyclerviewlib.model.Item;
import com.github.zdongcoding.recyclerviewlib.viewholder.AnimalViewHolder;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by zoudong on 2017/5/29.
 */

public class GridDividerActivity extends SimpleActivity {
    private List<Item> data;

    @Override
    void initView() {
        mRecyclerView.setLayoutManager(mGridLayoutManager);
        data = new ArrayList<>();
        mRecyclerListAdapter = new RecyclerListAdapter<Item, AnimalViewHolder>(this, data) {

        };
        mRecyclerView.setAdapter(mRecyclerListAdapter);
    }

    @Override
    void initData() {
        data.add(new Item(R.drawable.ic_animal0, "小狗0"));
        data.add(new Item(R.drawable.ic_animal1, "小狗1"));
        data.add(new Item(R.drawable.ic_animal1, "小狗2"));
        data.add(new Item(R.drawable.ic_cartoon0, "小狗0"));
        data.add(new Item(R.drawable.ic_cartoon1, "小狗1"));
        data.add(new Item(R.drawable.ic_cartoon2, "小狗2"));
        data.add(new Item(R.drawable.ic_scenic0, "小狗0"));
        data.add(new Item(R.drawable.ic_scenic1, "小狗1"));
        data.add(new Item(R.drawable.ic_scenic2, "小狗2"));
        mRecyclerListAdapter.set(data);

        mRecyclerView.addItemDecoration(new GridEdgeDividerDecoration(this,GridEdgeDividerDecoration.VERTICAL, ContextCompat.getDrawable(this,R.drawable.bg_animal_divider),ContextCompat.getDrawable(this,R.drawable.bg_animal_h_divider)));
    }
}
